﻿using FileConvert.AsposeOper;
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FileConvert
{

    public class XPSConvert : IConvert
    {

        public XPSConvert(string fromFile, string toFile)
        {
            _formFile = fromFile;
            _toFile = toFile;
            _ext = System.IO.Path.GetExtension(fromFile);
        }
        private string _formFile = "";
        private string _toFile = "";
        string _ext = "";
        public string SupportFormat
        {
            get
            {
                return ".txt;.doc;.docx;.xls;.xlsx;.ppt;.pptx;.epub;";
            }
        }

        public bool Convert()
        {
            bool result = false;

            switch (_ext)
            {
                case ".txt":
                case ".doc":
                case ".docx":
                    WordFile doc = new WordFile(_formFile, _toFile);
                    doc.ConvertToXPS();
                    result = true;
                    break;

                case ".xls":
                case ".xlsx":
                    ExcelFile xls = new ExcelFile(_formFile, _toFile);
                    xls.ConvertToXPS();
                    result = true;
                    break;

                case ".ppt":
                case ".pptx":
                    PPTFile ppt = new PPTFile(_formFile, _toFile);
                    ppt.ConvertToXPS();
                    result = true;
                    break;
                case ".epub":
                    EPubFile epubfile = new EPubFile(_formFile, _toFile);
                    epubfile.ConvertToXPS();
                    result = true;
                    break;
            }
            return result;
        }
    }
}
